//
//  SonTableViewCell3.m
//  QuickCure
//
//  Created by 雪中狼 on 9/13/16.
//  Copyright © 2016 haoge. All rights reserved.
//

#import "SonTableViewCell3.h"

@interface SonTableViewCell3()


@end
@implementation SonTableViewCell3

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self= [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self setupUI];
    }
    return self;
}
-(void)setupUI{
    UILabel * discribeLabel = [[UILabel alloc]init];
    discribeLabel.text=@"病例照片:";
    discribeLabel.font=[UIFont systemFontOfSize:16];
    discribeLabel.textColor=[UIColor blackColor];
    [self.contentView addSubview:discribeLabel];
    
    [discribeLabel makeConstraints:^(MASConstraintMaker *make) {
        make.top.left.equalTo(self.contentView).offset(20);
    }];

    
    _selectedPic =[[UIImageView alloc]init];
    _selectedPic.userInteractionEnabled=YES;
    
    UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(pickupPicture)];
    [_selectedPic addGestureRecognizer:tap];
    
    _selectedPic.image = [UIImage imageNamed:@"compose_pic_add_highlighted"];
    [self.contentView addSubview:_selectedPic];
    
    [_selectedPic makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(discribeLabel.mas_bottom).offset(20);
        make.left.equalTo(20);
        make.size.equalTo(120);
    }];
    
}

-(void)pickupPicture{
    
    if ([self.delegate respondsToSelector:@selector(presentPickerImageControllerWithcell:)]) {
        [self.delegate presentPickerImageControllerWithcell:self];
    }

    
}
@end
